package org.jctc.els.modules.biz.service.message.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jctc.els.modules.biz.mapper.message.MessageUserMapper;
import org.jctc.els.modules.biz.service.message.IMessageUserService;
import org.jctc.els.modules.biz.entity.message.MessageUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * <p>
 * 消息与人员关联表 服务实现类
 * </p>
 *
 * @author lyh
 * @since 2021-02-26
 */
@Service
public class MessageUserServiceImpl implements IMessageUserService {

    @Autowired
    private MessageUserMapper messageUserMapper;

    @Override
    public boolean save(MessageUser messageUser){
        return messageUserMapper.insert(messageUser)>0;
    }

    @Override
    public boolean remove(Long id){
        return messageUserMapper.deleteById(id)>0;
    }

    @Override
    public boolean edit(MessageUser messageUser){
        return messageUserMapper.updateById(messageUser)>0;
    }

    @Override
    public  Page<MessageUser> selectListByPage(Integer pageNum, Integer pageSize){
    Page<MessageUser> messageUserPage = new Page<>(pageNum, pageSize);
    MessageUser messageUser = new MessageUser();

    return (Page<MessageUser> )  messageUserMapper.selectPage(messageUserPage, Wrappers.query(messageUser));
    }

    @Override
    public MessageUser selectById(Long id){
        return  messageUserMapper.selectById(id);
    }
}
